package com.yuyou.fn.common.util;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Charsets;

/**
 * Created by wens on 2017/3/8.
 */
public class JSONS {

    public static byte[] toBytes(JSONObject jsonObject ){
        return jsonObject.toJSONString().getBytes(Charsets.UTF_8);
    }

    public static JSONObject toJSONObject(byte[] data){
        return JSON.parseObject(new String(data,Charsets.UTF_8)) ;
    }
}
